package Dic;

import java.io.UnsupportedEncodingException;

public class GBK {

	public final static int DEL_LOW_BYTE = 0X7F;
	/** GB2312 B0A1-F7FE */
	public final static int GB2312_HIGH_MIN = 0XB0;
	public final static int GB2312_HIGH_MAX = 0XF7;
	public final static int GB2312_LOW_MIN = 0XA1;
	public final static int GB2312_LOW_MAX = 0XFE;

	/** GBK/3: 8140-A0FE */
	public final static int GB13000_3_HIGH_MIN = 0X81;
	public final static int GB13000_3_HIGH_MAX = 0XA0;
	public final static int GB13000_3_LOW_MIN = 0X40;
	public final static int GB13000_3_LOW_MAX = 0XFE;
	
	/** GBK/4:  AA40-FEA0 */
	public final static int GB13000_4_HIGH_MIN = 0XAA;
	public final static int GB13000_4_HIGH_MAX = 0XFE;
	public final static int GB13000_4_LOW_MIN = 0X40;
	public final static int GB13000_4_LOW_MAX = 0XA0;

	/**
	 * @param args
	 * @throws UnsupportedEncodingException
	 */

	public static void main(String[] args) throws UnsupportedEncodingException {
		byte[] gbBytes = new byte[2];
		int index = 1;
		for (int h = GB2312_HIGH_MIN; h <= GB2312_HIGH_MAX; h++) {
			gbBytes[0] = (byte) h;
			for (int l = GB2312_LOW_MIN; l <= GB2312_LOW_MAX; l++) {
				gbBytes[1] = (byte) l;
				String ccStr = new String(gbBytes, "GBK");
				int codePoint = ccStr.codePointAt(0);
				if (!(codePoint >= 59408 && codePoint <= 59412)) {
					System.out.print(index++);
					System.out.println(ccStr.charAt(0));
				}

			}
		}

		for (int h = GB13000_3_HIGH_MIN; h <= GB13000_3_HIGH_MAX; h++) {
			gbBytes[0] = (byte) h;
			for (int l = GB13000_3_LOW_MIN; l <= GB13000_3_LOW_MAX; l++) {
				if (DEL_LOW_BYTE != l) {
					gbBytes[1] = (byte) l;
					String ccStr = new String(gbBytes, "GBK");
					System.out.print(index++);
					System.out.println(ccStr.charAt(0));
				}
			}
		}
		for (int h = GB13000_4_HIGH_MIN; h <= GB13000_4_HIGH_MAX; h++) {
			gbBytes[0] = (byte) h;
			for (int l = GB13000_4_LOW_MIN; l <= GB13000_4_LOW_MAX; l++) {
				if (DEL_LOW_BYTE != l) {
					gbBytes[1] = (byte) l;
					String ccStr = new String(gbBytes, "GBK");
					System.out.print(index++);
					System.out.println(ccStr.charAt(0));
				}
			}
		}
	}

}
